<template>
  <!-- 供方预付款-新增 -->
  <div class="e-form">
    <div class="tabs">
      <div class="tabs-title">基本信息</div>
      <div style="width: 100%" class="form">
        <el-form :model="formData" label-width="150px">
          <el-row>
            <el-col :span="12">
              <el-form-item label="结算编号:">
                <!-- <el-input
                  v-model="formData."
                ></el-input> -->
              </el-form-item>
            </el-col>
            <el-col :span="12">
                 <el-form-item label="单据机构:">
                     <!-- <el-input
                     disabled
                  placeholder="请填写"
                  v-model="formData"
                ></el-input> -->

              </el-form-item>

            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="合同类型:">
                <!-- <el-input
                  placeholder="请填写"
                  v-model="formData."
                ></el-input> -->
              </el-form-item>
            </el-col>
            <el-col :span="12">
                 <el-form-item label="合同名称:">
                <!-- <el-input
                  placeholder="请填写"
                  v-model="formData."
                ></el-input> -->
              </el-form-item>

            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="结算单位:">
                <!-- <el-input
                  placeholder="请填写"
                  v-model="formData."
                ></el-input> -->
              </el-form-item>
            </el-col>
            <el-col :span="12">
                 <el-form-item label="预付款日期:">
                <!-- <el-date-picker
                  v-model="formData."
                  type="date"
                  placeholder="选择日期"
                  :clearable="false"
                >
                </el-date-picker> -->
              </el-form-item>

            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
                 <el-form-item label="预付款金额(元):">
                     <!-- <el-input

                  placeholder="请填写"
                  v-model="formData."
                ></el-input> -->

              </el-form-item>

            </el-col>
            <el-col :span="12">
               <el-form-item label="币种">
                <!-- <el-input
                  placeholder="请填写"
                  v-model="formData."
                ></el-input> -->
              </el-form-item>

            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
                 <el-form-item label="本位币">
                <!-- <el-input
                  placeholder="请填写"
                  v-model="formData."
                ></el-input> -->
              </el-form-item>
            </el-col>
            <el-col :span="12">
                  <el-form-item label="传财务共享">
                <!-- <el-input
                  placeholder="请填写"
                  v-model="formData.showEas"
                ></el-input> -->
              </el-form-item>

            </el-col>
          </el-row>
           <el-row>
         <el-col :span="12">
             <el-form-item label="加扣款金额(本位币):">
                <!-- <el-input
                  placeholder="请填写"
                  v-model="formData."
                ></el-input> -->
              </el-form-item>
         </el-col>
           <el-col :span="12">
               <el-form-item label="状态">
                {{formData.state}}
                    <!-- 草稿/审核中/已审核/已关闭/已作废 -->
            </el-form-item>
         </el-col>
 </el-row>

          <el-row>
            <el-form-item label="备注">
              <!-- <el-input
                type="textarea"
                :rows="2"
                placeholder="请输入内容"
                v-model="formData."
              >
              </el-input> -->
            </el-form-item>
          </el-row>

        </el-form>
      </div>
    </div>
    <div class="buttons">
      <el-button type="primary" style="background: #2e61d7" @click="save()"
        >保存</el-button
      >
      <el-button type="primary" style="background: #2e61d7" @click="submit()"
        >保存并提交</el-button
      >

      <el-button @click="cancel()">关闭</el-button>
    </div>
    <span style="display: none">{{ localPopConfirm }}</span>
  </div>
</template>

<script>
import '@/utils/jquery.scrollTo.min'
import { mapMutations, mapState } from 'vuex'
import { showSuccessPop } from '@/utils/common'

export default {
    data () {
        return {
            //表单数据
            formData: {

            },
            orgId: '', //机构id
            orgName: '', //机构名称
            isSkip: false, //是否跳转
        }
    },
    computed: {
        ...mapState({
            options: state => state.contract.ctClassify,
            popConfirm: 'popConfirm',
            popStatus: 'popStatus',
        }),
        localPopConfirm () {
            if (this.popConfirm) {
                switch (this.popStatus) {
                case 'prompt':
                    this.delData()
                    break
                case 'success':
                    if (this.isSkip) this.handleClose()
                    break
                }
                this.setPopConfirm(false)
            }
            return this.popConfirm
        },
    },
    components: {},
    created () {
        let data = JSON.parse(localStorage.getItem('vuex'))
        this.orgId = data.userInfo.orgInfo.orgId
        this.orgName = data.userInfo.orgInfo.orgName
        // this.formData.orgName =  data.userInfo.orgInfo.orgName
        // this.formData.purchaserName = localStorage.getItem('userName')

    },
    mounted () {},
    beforeDestroy () {},
    methods: {
        ...mapMutations(['setPopConfirm']),

        //提交
        submit () {
            //let acceptanceDate = this.getTime(this.formData.acceptanceDate)
            this.$Ajax
                .httpPost({
                    url: '',
                    params: {

                    },
                })
                .then(() => {
                    showSuccessPop('保存成功！')
                    this.isSkip = false
                    this.$router.push('/supplierAdvanceClose')
                })
        },

        //保存按钮
        save () {

        },
        //取消按钮
        cancel () {
            this.$router.push('/supplierAdvanceClose')
        },
        //日期转换格式
        getTime (dt) {
            var year = dt.getFullYear() //年
            var month = dt.getMonth() + 1 //月
            var date = dt.getDate() //日
            month = month < 10 ? '0' + month : month
            date = date < 10 ? '0' + date : date
            var str = year + '-' + month + '-' + date
            return str
        },
    },
}
</script>

<style lang="scss" scoped>
.buttons {
  left: 0;
}
.e-form {
  margin-bottom: 80px;
  padding: 0 20px;
  .tabs-title::before {
    content: "";
    height: 22px;
    width: 8px;
    border-radius: 40px;
    background-color: #2e61d7;
    display: block;
    position: absolute;
    left: 20px;
    margin-right: 20px;
  }
}

.e-table {
  background: #fff;
}

.el-tab-pane {
  margin-left: -10px;
}
</style>
